<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./css/iview.css">
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- 生产环境版本，优化了尺寸和速度 -->
    <!-- <script src="https://cdn.jsdelivr.net/npm/vue"></script> -->
    <!-- https://www.iviewui.com/docs/guide/install vueUI库 -->
    <script src="./js/iview.min.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>

<body style="text-align:center">
    <div id="app">
        <p>{{ message }}</p>
        <input v-model="message">
        <button v-on:click="reverseMessage">逆转消息</button>
        <todo-item v-for="item in groceryList" v-bind:todo="item" v-bind:key="item.id">
        </todo-item>
        <div v-for="item in imgData">
            <img :src="item.picUrl" alt="">
        </div>

        <i-button @click="show">Click me!</i-button>
        <Modal v-model="visible" title="Welcome">Welcome to iView</Modal>

        <div>
            <i-button>Default</i-button>
            <i-button type="primary">Primary</i-button>
            <i-button type="dashed">Dashed</i-button>
            <i-button type="text">Text</i-button>
            <i-button type="info">Info</i-button>
            <i-button type="success">Success</i-button>
            <i-button type="warning">Warning</i-button>
            <i-button type="error">Error</i-button>
        </div>
        <div>
            <Row>
                <i-col span="12">
                    <date-picker type="year" placeholder="Select year" style="width: 200px"></date-picker>
                </i-col>
                <i-col span="12">
                    <date-picker type="month" placeholder="Select month" style="width: 200px"></date-picker>
                </i-col>
            </Row>
        </div>

        <a href="./pages/about/about.html">about</a>
    </div>


    <script src="./js/components/index.js">

    </script>
    <script>
        new Vue({
            el: '#app',
            name: 'index',

            // data是定义变量的地方
            data: {
                value1: 0,
                message: 'Hello Vue.js!',
                groceryList: [{
                        id: 0,
                        text: '蔬菜'
                    },
                    {
                        id: 1,
                        text: '奶酪'
                    },
                    {
                        id: 2,
                        text: '随便其它什么人吃的东西'
                    }
                ],
                imgData: [],
                visible: false
            },
            // methods是写函数的地方
            methods: {
                reverseMessage: function () {
                    this.message = this.message.split('').reverse().join('')
                },
                show: function () {
                    this.visible = true;
                },
                getMusic() {
                    // axios({
                    //     url: 'https://c.y.qq.com/musichall/fcgi-bin/fcg_yqqhomepagerecommend.fcg',
                    //     proxy: {
                    //         host: 'https://c.y.qq.com'
                    //     }

                    // }).then(res => {
                    //     console.log(res)
                    //     this.imgData = res.data.slider
                    //     debugger
                    // })
                },
            },

            mounted() {
                // mounted方法是写加载页面时要执行的函数（函数一样要写在methods里）
                this.getMusic()
            },
        })
    </script>
</body>

</html>